const path = require('path');
/*var webpack = require('webpack');
var ROOT_PATH = path.resolve(__dirname);
var APP_PATH = path.resolve(ROOT_PATH, 'src');
var BUILD_PATH = path.resolve(ROOT_PATH, 'build');
var TEM_PATH = path.resolve(ROOT_PATH, 'templates');*/
const htmlWebpackPlugin = require('html-webpack-plugin'); // 自动生成build文件夹及文件：

module.exports = {
	entry: './src/index.js',
	output: {
		path: __dirname,
		filename: './release/bundle.js'
	},
	resolve: {
         extensions: [".js", ".json", ".jsx", ".css",".scss"],
    },
	plugins: [
        //这个使用uglifyJs压缩你的js代码
        // new webpack.optimize.UglifyJsPlugin({ minimize: true }),
        new htmlWebpackPlugin({
           	template: './index.html'
        })
    ],
    devServer: {
    	contentBase: path.join(__dirname, './release'),
        inline: true, //实时刷新
        port: 3000
    },
    module: {
        rules: [{
            test: /\.js?$/,
            exclude: /(node_modules)/,
            loader: 'babel-loader'
        }]
    }

}